<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    /* 
      :checked 
      可获取已经选中的表单元素
     */
    input:checked {
      width: 50px;
      height: 50px;
    }
  </style>
</head>
<body>
  <input type="checkbox" checked>
  <input type="checkbox" checked>
  <input type="checkbox" checked>
  <input type="checkbox" checked>
  <input type="checkbox" checked>
  <script>
    var ckeds = document.querySelectorAll('input:checked');
    console.log(ckeds.length);
    var cks = document.querySelectorAll('input');
    console.log(cks.length);
  </script>
</body>
</html>